package com.kuqi.core;

import android.os.Handler;
import com.kuqi.entitiy.UserInfo;
import com.kuqi.http.HttpCmd;
import com.kuqi.utils.UrlTool;

public class PersistentDataWorker {

    public void searchHomeData(PersistentFuncWorker worker, Handler handler, UserInfo userInfo){
        // 查询banner数据
        final String params_banner = "{\"isChild\" : " + userInfo.getUserAgeLimit() + ", \"limit\" : 9}"; // 1=true=未成年人 0=false=成年人
        HttpCmd cmd_banner = new HttpCmd(handler, params_banner, UrlTool.URL_BANNER, ApplicationPersistent.HANDLER_KEY_HOME_DATA_BANNER);
        worker.SendHttp(cmd_banner);
        // 查询music数据
        final String params_music = "{\"type\" : 2,\"isChild\" : " + userInfo.getUserAgeLimit() + "}"; // 视频类型 1=科技 2=音乐 3=动漫
        HttpCmd cmd_music = new HttpCmd(handler, params_music, UrlTool.URL_VIDEO, ApplicationPersistent.HANDLER_KEY_HOME_DATA_MUSIC);
        worker.SendHttp(cmd_music);
        // 查询science数据
        final String param_science = "{\"type\" : 1,\"isChild\" : " + userInfo.getUserAgeLimit() + "}"; // 视频类型 1=科技 2=音乐 3=动漫
        HttpCmd cmd_science = new HttpCmd(handler, param_science, UrlTool.URL_VIDEO, ApplicationPersistent.HANDLER_KEY_HOME_DATA_SCIENCE);
        worker.SendHttp(cmd_science);
        // 查询carton数据
        final String params_carton = "{\"type\" : 3,\"isChild\" : " + userInfo.getUserAgeLimit() + "}"; // 视频类型 1=科技 2=音乐 3=动漫
        HttpCmd cmd_carton = new HttpCmd(handler, params_carton, UrlTool.URL_VIDEO, ApplicationPersistent.HANDLER_KEY_HOME_DATA_CARTON);
        worker.SendHttp(cmd_carton);
    }


    public void searchStoreData(PersistentFuncWorker worker, Handler handler, UserInfo userInfo){
        // 查询promotion数据
        final String params_promotion = "{\"limitNum\":5}";
        HttpCmd cmd_promotion = new HttpCmd(handler, params_promotion, UrlTool.URL_PROMOTION, ApplicationPersistent.HANDLER_KEY_STORE_DATA_PROMOTION);
        worker.SendHttp(cmd_promotion);
        // 查询LOVE数据
        final String params_love = "{\"bookType\":1 , \"limitNum\":18}"; // 1=言情 2=穿越 3=名著 4=网游
        HttpCmd cmd_love = new HttpCmd(handler, params_love, UrlTool.URL_BOOK, ApplicationPersistent.HANDLER_KEY_STORE_DATA_LOVE);
        worker.SendHttp(cmd_love);
        // 查询travel数据
        final String params_travel = "{\"bookType\":2 , \"limitNum\":18}";// 1=言情 2=穿越 3=名著 4=网游
        HttpCmd cmd_travel = new HttpCmd(handler, params_travel, UrlTool.URL_BOOK, ApplicationPersistent.HANDLER_KEY_STORE_DATA_TRAVEL);
        worker.SendHttp(cmd_travel);
        // 查询master数据
        final String params_master = "{\"bookType\":3 , \"limitNum\":18}";// 1=言情 2=穿越 3=名著 4=网游
        HttpCmd cmd_master = new HttpCmd(handler, params_master, UrlTool.URL_BOOK, ApplicationPersistent.HANDLER_KEY_STORE_DATA_MASTER);
        worker.SendHttp(cmd_master);
        // 查询game数据
        final String params_game = "{\"bookType\":4 , \"limitNum\":18}";// 1=言情 2=穿越 3=名著 4=网游
        HttpCmd cmd_game = new HttpCmd(handler, params_game, UrlTool.URL_BOOK, ApplicationPersistent.HANDLER_KEY_STORE_DATA_GAME);
        worker.SendHttp(cmd_game);
    }







}
